package com.sniper.web.listener;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 开机启动一些计划任务
 *
 * @author suzhen
 */
@Component
public class InitStartOnBoot implements ApplicationListener<ContextRefreshedEvent> {

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        //这里被执行了2遍
        System.out.println("spring 初始化...:" + new Date());
    }

}
